﻿<?php
if(!defined('IN_PHPSCUP'))exit('hacking'); 
class NavModel extends BaseModel
{

    var $table  = 'navigation';	

    var $_page_rows = 20;	
	
    /* 插入数据 */
    function post($data)
    {  
    
		return $this->IU_Sql_Exe(array ('data' => array('type'=>"$data[scup]",'parent_id'=>"$data[parent_id]",'name'=>"$data[title]",'lang_type'=>"$data[lang]",'link'=>"$data[url]",'whree'=>"$data[position]",'config'=>"$data[config]"), 'mode' => 'INSERT'));

        
    }

    function show()
    {   
	
		 $info = $this->S_Sql_Exe(array('fields' =>'*','conditions' =>"lang_type='".trim($GLOBALS['Lang']->_lang_tp)."' "));
    
		 return $info;
        
    }
    function allshow()
    {   
	
		 $info = $this->S_Sql_Exe(array('fields' =>'*'));
    
		 return $info;
        
    }	

    /* 删除数据 */
    function del($id ='')
    {      
		return $this->D_Sql_Exe(array ('conditions' =>"nav_id = '{$id}' "));
        
    }

    /* 修改数据 */
    function editaction($id ='',$data = '')
    {    
 	      
		return $this->IU_Sql_Exe(array ('data' => array('type'=>"$data[scup]",'name'=>"$data[title]",'parent_id'=>"$data[parent_id]",'lang_type'=>"$data[lang]",'link'=>"$data[url]",'whree'=>"$data[position]",'config'=>"$data[config]"),'mode' => 'UPDATE','conditions' =>"nav_id = '{$id}' "));
        
    }

    /* 修改数据 */
    function editsort($id ='',$data = '')
    {   
     
		return $this->IU_Sql_Exe(array ('data' => array('sort_order'=>"$data[sort]"),'mode' => 'UPDATE','conditions' =>"nav_id = '{$id}' "));
        
    }


    /* 修改数据 */
    function editname($id ='',$data = '')
    {   
     
		return $this->IU_Sql_Exe(array ('data' => array('name'=>"$data[name]"),'mode' => 'UPDATE','conditions' =>"nav_id = '{$id}' "));
        
    }




    /* 通过id取出一条数据 */
    function oneshow($id ='')
    {    
	      
		 $info = $this->S_Sql_Exe(array('fields' =>'*','conditions' =>"nav_id='{$id}'",'return' =>'one'));
    
		 return $info;
        
    }


}





?>